package cc.linker.steplink.crm.task;


import cc.linker.steplink.crm.commons.lock.RedisLock;
import cc.linker.steplink.crm.merchant.service.MallBoomBackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;


/**
 * 维护中金支付分账账户任务
 */
@Component
public class AcsOrgConfigTask {


    @Autowired
    private MallBoomBackService mallBoomBackService;

    @RedisLock(value = "acsOrgConf")
    @Scheduled(cron = "2 0 0 * * ?")
    public void acsOrgConf() {
        List<Map<String, String>> allOrgConfList = mallBoomBackService.getAllOrgConf();
        for (Map<String, String> da : allOrgConfList) {
            mallBoomBackService.setOrgAccountConf(da);
            mallBoomBackService.cancelOrgAccountConf(da.get("orgId"));
        }
    }
}
